3.9.7 \(\int (d+e x) (f+g x)^n (a+2 c d x+c e x^2) \, dx\) [807]

3.9.7.1 Optimal result
3.9.7.2 Mathematica [A] (verified)
3.9.7.3 Rubi [A] (verified)
3.9.7.4 Maple [B] (verified)
3.9.7.5 Fricas [B] (verification not implemented)
3.9.7.6 Sympy [B] (verification not implemented)
3.9.7.7 Maxima [A] (verification not implemented)
3.9.7.8 Giac [B] (verification not implemented)
3.9.7.9 Mupad [B] (verification not implemented)

3.9.7.1 Optimal result

Integrand size = 26, antiderivative size = 146 \[ \int (d+e x) (f+g x)^n \left (a+2 c d x+c e x^2\right ) \, dx=-\frac {(e f-d g) \left (a g^2+c f (e f-2 d g)\right ) (f+g x)^{1+n}}{g^4 (1+n)}+\frac {\left (a e g^2+c \left (3 e^2 f^2-6 d e f g+2 d^2 g^2\right )\right ) (f+g x)^{2+n}}{g^4 (2+n)}-\frac {3 c e (e f-d g) (f+g x)^{3+n}}{g^4 (3+n)}+\frac {c e^2 (f+g x)^{4+n}}{g^4 (4+n)} \]

output
-(-d*g+e*f)*(a*g^2+c*f*(-2*d*g+e*f))*(g*x+f)^(1+n)/g^4/(1+n)+(a*e*g^2+c*(2 
*d^2*g^2-6*d*e*f*g+3*e^2*f^2))*(g*x+f)^(2+n)/g^4/(2+n)-3*c*e*(-d*g+e*f)*(g 
*x+f)^(3+n)/g^4/(3+n)+c*e^2*(g*x+f)^(4+n)/g^4/(4+n)
 
3.9.7.2 Mathematica [A] (verified)

Time = 0.16 (sec) , antiderivative size = 130, normalized size of antiderivative = 0.89 \[ \int (d+e x) (f+g x)^n \left (a+2 c d x+c e x^2\right ) \, dx=\frac {(f+g x)^{1+n} \left (-\frac {(e f-d g) \left (a g^2+c f (e f-2 d g)\right )}{1+n}+\frac {\left (a e g^2+c \left (3 e^2 f^2-6 d e f g+2 d^2 g^2\right )\right ) (f+g x)}{2+n}-\frac {3 c e (e f-d g) (f+g x)^2}{3+n}+\frac {c e^2 (f+g x)^3}{4+n}\right )}{g^4} \]

input
Integrate[(d + e*x)*(f + g*x)^n*(a + 2*c*d*x + c*e*x^2),x]
 
output
((f + g*x)^(1 + n)*(-(((e*f - d*g)*(a*g^2 + c*f*(e*f - 2*d*g)))/(1 + n)) + 
 ((a*e*g^2 + c*(3*e^2*f^2 - 6*d*e*f*g + 2*d^2*g^2))*(f + g*x))/(2 + n) - ( 
3*c*e*(e*f - d*g)*(f + g*x)^2)/(3 + n) + (c*e^2*(f + g*x)^3)/(4 + n)))/g^4
 
3.9.7.3 Rubi [A] (verified)

Time = 0.31 (sec) , antiderivative size = 146, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.077, Rules used = {1195, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int (d+e x) (f+g x)^n \left (a+2 c d x+c e x^2\right ) \, dx\)

\(\Big \downarrow \) 1195

\(\displaystyle \int \left (\frac {(f+g x)^{n+1} \left (a e g^2+c \left (2 d^2 g^2-6 d e f g+3 e^2 f^2\right )\right )}{g^3}+\frac {(e f-d g) (f+g x)^n \left (-a g^2-c f (e f-2 d g)\right )}{g^3}-\frac {3 c e (e f-d g) (f+g x)^{n+2}}{g^3}+\frac {c e^2 (f+g x)^{n+3}}{g^3}\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {(f+g x)^{n+2} \left (a e g^2+c \left (2 d^2 g^2-6 d e f g+3 e^2 f^2\right )\right )}{g^4 (n+2)}-\frac {(e f-d g) (f+g x)^{n+1} \left (a g^2+c f (e f-2 d g)\right )}{g^4 (n+1)}-\frac {3 c e (e f-d g) (f+g x)^{n+3}}{g^4 (n+3)}+\frac {c e^2 (f+g x)^{n+4}}{g^4 (n+4)}\)

input
Int[(d + e*x)*(f + g*x)^n*(a + 2*c*d*x + c*e*x^2),x]
 
output
-(((e*f - d*g)*(a*g^2 + c*f*(e*f - 2*d*g))*(f + g*x)^(1 + n))/(g^4*(1 + n) 
)) + ((a*e*g^2 + c*(3*e^2*f^2 - 6*d*e*f*g + 2*d^2*g^2))*(f + g*x)^(2 + n)) 
/(g^4*(2 + n)) - (3*c*e*(e*f - d*g)*(f + g*x)^(3 + n))/(g^4*(3 + n)) + (c* 
e^2*(f + g*x)^(4 + n))/(g^4*(4 + n))
 

3.9.7.3.1 Defintions of rubi rules used

rule 1195
Int[((d_.) + (e_.)*(x_))^(m_.)*((f_.) + (g_.)*(x_))^(n_.)*((a_.) + (b_.)*(x 
_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(d + e*x)^m*(f + 
 g*x)^n*(a + b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, f, g, m, n}, x 
] && IGtQ[p, 0]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 
3.9.7.4 Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(448\) vs. \(2(146)=292\).

Time = 0.50 (sec) , antiderivative size = 449, normalized size of antiderivative = 3.08

method result size
gosper \(\frac {\left (g x +f \right )^{1+n} \left (c \,e^{2} g^{3} n^{3} x^{3}+3 c d e \,g^{3} n^{3} x^{2}+6 c \,e^{2} g^{3} n^{2} x^{3}+2 c \,d^{2} g^{3} n^{3} x +21 c d e \,g^{3} n^{2} x^{2}-3 c \,e^{2} f \,g^{2} n^{2} x^{2}+11 c \,e^{2} g^{3} n \,x^{3}+a e \,g^{3} n^{3} x +16 c \,d^{2} g^{3} n^{2} x -6 c d e f \,g^{2} n^{2} x +42 c d e \,g^{3} n \,x^{2}-9 c \,e^{2} f \,g^{2} n \,x^{2}+6 c \,e^{2} x^{3} g^{3}+a d \,g^{3} n^{3}+8 a e \,g^{3} n^{2} x -2 c \,d^{2} f \,g^{2} n^{2}+38 c \,d^{2} g^{3} n x -30 c d e f \,g^{2} n x +24 c d e \,g^{3} x^{2}+6 c \,e^{2} f^{2} g n x -6 c \,e^{2} f \,g^{2} x^{2}+9 a d \,g^{3} n^{2}-a e f \,g^{2} n^{2}+19 a e \,g^{3} n x -14 c \,d^{2} f \,g^{2} n +24 c \,d^{2} g^{3} x +6 c d e \,f^{2} g n -24 c d e f \,g^{2} x +6 c \,e^{2} f^{2} g x +26 a d \,g^{3} n -7 a e f \,g^{2} n +12 a e \,g^{3} x -24 c \,d^{2} f \,g^{2}+24 c d e \,f^{2} g -6 c \,e^{2} f^{3}+24 a d \,g^{3}-12 a e f \,g^{2}\right )}{g^{4} \left (n^{4}+10 n^{3}+35 n^{2}+50 n +24\right )}\) \(449\)
norman \(\frac {c \,e^{2} x^{4} {\mathrm e}^{n \ln \left (g x +f \right )}}{4+n}+\frac {f \left (a d \,g^{3} n^{3}-2 c \,d^{2} f \,g^{2} n^{2}+9 a d \,g^{3} n^{2}-a e f \,g^{2} n^{2}-14 c \,d^{2} f \,g^{2} n +6 c d e \,f^{2} g n +26 a d \,g^{3} n -7 a e f \,g^{2} n -24 c \,d^{2} f \,g^{2}+24 c d e \,f^{2} g -6 c \,e^{2} f^{3}+24 a d \,g^{3}-12 a e f \,g^{2}\right ) {\mathrm e}^{n \ln \left (g x +f \right )}}{g^{4} \left (n^{4}+10 n^{3}+35 n^{2}+50 n +24\right )}+\frac {\left (2 c \,d^{2} g^{2} n^{2}+3 c d e f g \,n^{2}+a e \,g^{2} n^{2}+14 c \,d^{2} g^{2} n +12 c d e f g n -3 c \,e^{2} f^{2} n +7 a e \,g^{2} n +24 c \,d^{2} g^{2}+12 a e \,g^{2}\right ) x^{2} {\mathrm e}^{n \ln \left (g x +f \right )}}{g^{2} \left (n^{3}+9 n^{2}+26 n +24\right )}+\frac {\left (2 c \,d^{2} f \,g^{2} n^{3}+a d \,g^{3} n^{3}+a e f \,g^{2} n^{3}+14 c \,d^{2} f \,g^{2} n^{2}-6 c d e \,f^{2} g \,n^{2}+9 a d \,g^{3} n^{2}+7 a e f \,g^{2} n^{2}+24 c \,d^{2} f \,g^{2} n -24 c d e \,f^{2} g n +6 c \,e^{2} f^{3} n +26 a d \,g^{3} n +12 a e f \,g^{2} n +24 a d \,g^{3}\right ) x \,{\mathrm e}^{n \ln \left (g x +f \right )}}{g^{3} \left (n^{4}+10 n^{3}+35 n^{2}+50 n +24\right )}+\frac {\left (3 d g n +e f n +12 d g \right ) c e \,x^{3} {\mathrm e}^{n \ln \left (g x +f \right )}}{g \left (n^{2}+7 n +12\right )}\) \(508\)
risch \(\frac {\left (c \,e^{2} g^{4} n^{3} x^{4}+3 c d e \,g^{4} n^{3} x^{3}+c \,e^{2} f \,g^{3} n^{3} x^{3}+6 c \,e^{2} g^{4} n^{2} x^{4}+2 c \,d^{2} g^{4} n^{3} x^{2}+3 c d e f \,g^{3} n^{3} x^{2}+21 c d e \,g^{4} n^{2} x^{3}+3 c \,e^{2} f \,g^{3} n^{2} x^{3}+11 c \,e^{2} g^{4} n \,x^{4}+a e \,g^{4} n^{3} x^{2}+2 c \,d^{2} f \,g^{3} n^{3} x +16 c \,d^{2} g^{4} n^{2} x^{2}+15 c d e f \,g^{3} n^{2} x^{2}+42 c d e \,g^{4} n \,x^{3}-3 c \,e^{2} f^{2} g^{2} n^{2} x^{2}+2 c \,e^{2} f \,g^{3} n \,x^{3}+6 c \,e^{2} x^{4} g^{4}+a d \,g^{4} n^{3} x +a e f \,g^{3} n^{3} x +8 a e \,g^{4} n^{2} x^{2}+14 c \,d^{2} f \,g^{3} n^{2} x +38 c \,d^{2} g^{4} n \,x^{2}-6 c d e \,f^{2} g^{2} n^{2} x +12 c d e f \,g^{3} n \,x^{2}+24 c d e \,g^{4} x^{3}-3 c \,e^{2} f^{2} g^{2} n \,x^{2}+a d f \,g^{3} n^{3}+9 a d \,g^{4} n^{2} x +7 a e f \,g^{3} n^{2} x +19 a e \,g^{4} n \,x^{2}-2 c \,d^{2} f^{2} g^{2} n^{2}+24 c \,d^{2} f \,g^{3} n x +24 c \,d^{2} g^{4} x^{2}-24 c d e \,f^{2} g^{2} n x +6 c \,e^{2} f^{3} g n x +9 a d f \,g^{3} n^{2}+26 a d \,g^{4} n x -a e \,f^{2} g^{2} n^{2}+12 a e f \,g^{3} n x +12 a e \,g^{4} x^{2}-14 c \,d^{2} f^{2} g^{2} n +6 c d e \,f^{3} g n +26 a d f \,g^{3} n +24 a d \,g^{4} x -7 a e \,f^{2} g^{2} n -24 c \,d^{2} f^{2} g^{2}+24 c d e \,f^{3} g -6 c \,e^{2} f^{4}+24 a d f \,g^{3}-12 a e \,f^{2} g^{2}\right ) \left (g x +f \right )^{n}}{\left (3+n \right ) \left (4+n \right ) \left (2+n \right ) \left (1+n \right ) g^{4}}\) \(652\)
parallelrisch \(\text {Expression too large to display}\) \(1050\)

input
int((e*x+d)*(g*x+f)^n*(c*e*x^2+2*c*d*x+a),x,method=_RETURNVERBOSE)
 
output
1/g^4*(g*x+f)^(1+n)/(n^4+10*n^3+35*n^2+50*n+24)*(c*e^2*g^3*n^3*x^3+3*c*d*e 
*g^3*n^3*x^2+6*c*e^2*g^3*n^2*x^3+2*c*d^2*g^3*n^3*x+21*c*d*e*g^3*n^2*x^2-3* 
c*e^2*f*g^2*n^2*x^2+11*c*e^2*g^3*n*x^3+a*e*g^3*n^3*x+16*c*d^2*g^3*n^2*x-6* 
c*d*e*f*g^2*n^2*x+42*c*d*e*g^3*n*x^2-9*c*e^2*f*g^2*n*x^2+6*c*e^2*g^3*x^3+a 
*d*g^3*n^3+8*a*e*g^3*n^2*x-2*c*d^2*f*g^2*n^2+38*c*d^2*g^3*n*x-30*c*d*e*f*g 
^2*n*x+24*c*d*e*g^3*x^2+6*c*e^2*f^2*g*n*x-6*c*e^2*f*g^2*x^2+9*a*d*g^3*n^2- 
a*e*f*g^2*n^2+19*a*e*g^3*n*x-14*c*d^2*f*g^2*n+24*c*d^2*g^3*x+6*c*d*e*f^2*g 
*n-24*c*d*e*f*g^2*x+6*c*e^2*f^2*g*x+26*a*d*g^3*n-7*a*e*f*g^2*n+12*a*e*g^3* 
x-24*c*d^2*f*g^2+24*c*d*e*f^2*g-6*c*e^2*f^3+24*a*d*g^3-12*a*e*f*g^2)
 
3.9.7.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 549 vs. \(2 (146) = 292\).

Time = 0.33 (sec) , antiderivative size = 549, normalized size of antiderivative = 3.76 \[ \int (d+e x) (f+g x)^n \left (a+2 c d x+c e x^2\right ) \, dx=\frac {{\left (a d f g^{3} n^{3} - 6 \, c e^{2} f^{4} + 24 \, c d e f^{3} g + 24 \, a d f g^{3} - 12 \, {\left (2 \, c d^{2} + a e\right )} f^{2} g^{2} + {\left (c e^{2} g^{4} n^{3} + 6 \, c e^{2} g^{4} n^{2} + 11 \, c e^{2} g^{4} n + 6 \, c e^{2} g^{4}\right )} x^{4} + {\left (24 \, c d e g^{4} + {\left (c e^{2} f g^{3} + 3 \, c d e g^{4}\right )} n^{3} + 3 \, {\left (c e^{2} f g^{3} + 7 \, c d e g^{4}\right )} n^{2} + 2 \, {\left (c e^{2} f g^{3} + 21 \, c d e g^{4}\right )} n\right )} x^{3} + {\left (9 \, a d f g^{3} - {\left (2 \, c d^{2} + a e\right )} f^{2} g^{2}\right )} n^{2} + {\left (12 \, {\left (2 \, c d^{2} + a e\right )} g^{4} + {\left (3 \, c d e f g^{3} + {\left (2 \, c d^{2} + a e\right )} g^{4}\right )} n^{3} - {\left (3 \, c e^{2} f^{2} g^{2} - 15 \, c d e f g^{3} - 8 \, {\left (2 \, c d^{2} + a e\right )} g^{4}\right )} n^{2} - {\left (3 \, c e^{2} f^{2} g^{2} - 12 \, c d e f g^{3} - 19 \, {\left (2 \, c d^{2} + a e\right )} g^{4}\right )} n\right )} x^{2} + {\left (6 \, c d e f^{3} g + 26 \, a d f g^{3} - 7 \, {\left (2 \, c d^{2} + a e\right )} f^{2} g^{2}\right )} n + {\left (24 \, a d g^{4} + {\left (a d g^{4} + {\left (2 \, c d^{2} + a e\right )} f g^{3}\right )} n^{3} - {\left (6 \, c d e f^{2} g^{2} - 9 \, a d g^{4} - 7 \, {\left (2 \, c d^{2} + a e\right )} f g^{3}\right )} n^{2} + 2 \, {\left (3 \, c e^{2} f^{3} g - 12 \, c d e f^{2} g^{2} + 13 \, a d g^{4} + 6 \, {\left (2 \, c d^{2} + a e\right )} f g^{3}\right )} n\right )} x\right )} {\left (g x + f\right )}^{n}}{g^{4} n^{4} + 10 \, g^{4} n^{3} + 35 \, g^{4} n^{2} + 50 \, g^{4} n + 24 \, g^{4}} \]

input
integrate((e*x+d)*(g*x+f)^n*(c*e*x^2+2*c*d*x+a),x, algorithm="fricas")
 
output
(a*d*f*g^3*n^3 - 6*c*e^2*f^4 + 24*c*d*e*f^3*g + 24*a*d*f*g^3 - 12*(2*c*d^2 
 + a*e)*f^2*g^2 + (c*e^2*g^4*n^3 + 6*c*e^2*g^4*n^2 + 11*c*e^2*g^4*n + 6*c* 
e^2*g^4)*x^4 + (24*c*d*e*g^4 + (c*e^2*f*g^3 + 3*c*d*e*g^4)*n^3 + 3*(c*e^2* 
f*g^3 + 7*c*d*e*g^4)*n^2 + 2*(c*e^2*f*g^3 + 21*c*d*e*g^4)*n)*x^3 + (9*a*d* 
f*g^3 - (2*c*d^2 + a*e)*f^2*g^2)*n^2 + (12*(2*c*d^2 + a*e)*g^4 + (3*c*d*e* 
f*g^3 + (2*c*d^2 + a*e)*g^4)*n^3 - (3*c*e^2*f^2*g^2 - 15*c*d*e*f*g^3 - 8*( 
2*c*d^2 + a*e)*g^4)*n^2 - (3*c*e^2*f^2*g^2 - 12*c*d*e*f*g^3 - 19*(2*c*d^2 
+ a*e)*g^4)*n)*x^2 + (6*c*d*e*f^3*g + 26*a*d*f*g^3 - 7*(2*c*d^2 + a*e)*f^2 
*g^2)*n + (24*a*d*g^4 + (a*d*g^4 + (2*c*d^2 + a*e)*f*g^3)*n^3 - (6*c*d*e*f 
^2*g^2 - 9*a*d*g^4 - 7*(2*c*d^2 + a*e)*f*g^3)*n^2 + 2*(3*c*e^2*f^3*g - 12* 
c*d*e*f^2*g^2 + 13*a*d*g^4 + 6*(2*c*d^2 + a*e)*f*g^3)*n)*x)*(g*x + f)^n/(g 
^4*n^4 + 10*g^4*n^3 + 35*g^4*n^2 + 50*g^4*n + 24*g^4)
 
3.9.7.6 Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 4952 vs. \(2 (134) = 268\).

Time = 1.16 (sec) , antiderivative size = 4952, normalized size of antiderivative = 33.92 \[ \int (d+e x) (f+g x)^n \left (a+2 c d x+c e x^2\right ) \, dx=\text {Too large to display} \]

input
integrate((e*x+d)*(g*x+f)**n*(c*e*x**2+2*c*d*x+a),x)
 
output
Piecewise((f**n*(a*d*x + a*e*x**2/2 + c*d**2*x**2 + c*d*e*x**3 + c*e**2*x* 
*4/4), Eq(g, 0)), (-2*a*d*g**3/(6*f**3*g**4 + 18*f**2*g**5*x + 18*f*g**6*x 
**2 + 6*g**7*x**3) - a*e*f*g**2/(6*f**3*g**4 + 18*f**2*g**5*x + 18*f*g**6* 
x**2 + 6*g**7*x**3) - 3*a*e*g**3*x/(6*f**3*g**4 + 18*f**2*g**5*x + 18*f*g* 
*6*x**2 + 6*g**7*x**3) - 2*c*d**2*f*g**2/(6*f**3*g**4 + 18*f**2*g**5*x + 1 
8*f*g**6*x**2 + 6*g**7*x**3) - 6*c*d**2*g**3*x/(6*f**3*g**4 + 18*f**2*g**5 
*x + 18*f*g**6*x**2 + 6*g**7*x**3) - 6*c*d*e*f**2*g/(6*f**3*g**4 + 18*f**2 
*g**5*x + 18*f*g**6*x**2 + 6*g**7*x**3) - 18*c*d*e*f*g**2*x/(6*f**3*g**4 + 
 18*f**2*g**5*x + 18*f*g**6*x**2 + 6*g**7*x**3) - 18*c*d*e*g**3*x**2/(6*f* 
*3*g**4 + 18*f**2*g**5*x + 18*f*g**6*x**2 + 6*g**7*x**3) + 6*c*e**2*f**3*l 
og(f/g + x)/(6*f**3*g**4 + 18*f**2*g**5*x + 18*f*g**6*x**2 + 6*g**7*x**3) 
+ 11*c*e**2*f**3/(6*f**3*g**4 + 18*f**2*g**5*x + 18*f*g**6*x**2 + 6*g**7*x 
**3) + 18*c*e**2*f**2*g*x*log(f/g + x)/(6*f**3*g**4 + 18*f**2*g**5*x + 18* 
f*g**6*x**2 + 6*g**7*x**3) + 27*c*e**2*f**2*g*x/(6*f**3*g**4 + 18*f**2*g** 
5*x + 18*f*g**6*x**2 + 6*g**7*x**3) + 18*c*e**2*f*g**2*x**2*log(f/g + x)/( 
6*f**3*g**4 + 18*f**2*g**5*x + 18*f*g**6*x**2 + 6*g**7*x**3) + 18*c*e**2*f 
*g**2*x**2/(6*f**3*g**4 + 18*f**2*g**5*x + 18*f*g**6*x**2 + 6*g**7*x**3) + 
 6*c*e**2*g**3*x**3*log(f/g + x)/(6*f**3*g**4 + 18*f**2*g**5*x + 18*f*g**6 
*x**2 + 6*g**7*x**3), Eq(n, -4)), (-a*d*g**3/(2*f**2*g**4 + 4*f*g**5*x + 2 
*g**6*x**2) - a*e*f*g**2/(2*f**2*g**4 + 4*f*g**5*x + 2*g**6*x**2) - 2*a...
 
3.9.7.7 Maxima [A] (verification not implemented)

Time = 0.22 (sec) , antiderivative size = 289, normalized size of antiderivative = 1.98 \[ \int (d+e x) (f+g x)^n \left (a+2 c d x+c e x^2\right ) \, dx=\frac {2 \, {\left (g^{2} {\left (n + 1\right )} x^{2} + f g n x - f^{2}\right )} {\left (g x + f\right )}^{n} c d^{2}}{{\left (n^{2} + 3 \, n + 2\right )} g^{2}} + \frac {3 \, {\left ({\left (n^{2} + 3 \, n + 2\right )} g^{3} x^{3} + {\left (n^{2} + n\right )} f g^{2} x^{2} - 2 \, f^{2} g n x + 2 \, f^{3}\right )} {\left (g x + f\right )}^{n} c d e}{{\left (n^{3} + 6 \, n^{2} + 11 \, n + 6\right )} g^{3}} + \frac {{\left (g^{2} {\left (n + 1\right )} x^{2} + f g n x - f^{2}\right )} {\left (g x + f\right )}^{n} a e}{{\left (n^{2} + 3 \, n + 2\right )} g^{2}} + \frac {{\left (g x + f\right )}^{n + 1} a d}{g {\left (n + 1\right )}} + \frac {{\left ({\left (n^{3} + 6 \, n^{2} + 11 \, n + 6\right )} g^{4} x^{4} + {\left (n^{3} + 3 \, n^{2} + 2 \, n\right )} f g^{3} x^{3} - 3 \, {\left (n^{2} + n\right )} f^{2} g^{2} x^{2} + 6 \, f^{3} g n x - 6 \, f^{4}\right )} {\left (g x + f\right )}^{n} c e^{2}}{{\left (n^{4} + 10 \, n^{3} + 35 \, n^{2} + 50 \, n + 24\right )} g^{4}} \]

input
integrate((e*x+d)*(g*x+f)^n*(c*e*x^2+2*c*d*x+a),x, algorithm="maxima")
 
output
2*(g^2*(n + 1)*x^2 + f*g*n*x - f^2)*(g*x + f)^n*c*d^2/((n^2 + 3*n + 2)*g^2 
) + 3*((n^2 + 3*n + 2)*g^3*x^3 + (n^2 + n)*f*g^2*x^2 - 2*f^2*g*n*x + 2*f^3 
)*(g*x + f)^n*c*d*e/((n^3 + 6*n^2 + 11*n + 6)*g^3) + (g^2*(n + 1)*x^2 + f* 
g*n*x - f^2)*(g*x + f)^n*a*e/((n^2 + 3*n + 2)*g^2) + (g*x + f)^(n + 1)*a*d 
/(g*(n + 1)) + ((n^3 + 6*n^2 + 11*n + 6)*g^4*x^4 + (n^3 + 3*n^2 + 2*n)*f*g 
^3*x^3 - 3*(n^2 + n)*f^2*g^2*x^2 + 6*f^3*g*n*x - 6*f^4)*(g*x + f)^n*c*e^2/ 
((n^4 + 10*n^3 + 35*n^2 + 50*n + 24)*g^4)
 
3.9.7.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 1008 vs. \(2 (146) = 292\).

Time = 0.28 (sec) , antiderivative size = 1008, normalized size of antiderivative = 6.90 \[ \int (d+e x) (f+g x)^n \left (a+2 c d x+c e x^2\right ) \, dx=\frac {{\left (g x + f\right )}^{n} c e^{2} g^{4} n^{3} x^{4} + {\left (g x + f\right )}^{n} c e^{2} f g^{3} n^{3} x^{3} + 3 \, {\left (g x + f\right )}^{n} c d e g^{4} n^{3} x^{3} + 6 \, {\left (g x + f\right )}^{n} c e^{2} g^{4} n^{2} x^{4} + 3 \, {\left (g x + f\right )}^{n} c d e f g^{3} n^{3} x^{2} + 2 \, {\left (g x + f\right )}^{n} c d^{2} g^{4} n^{3} x^{2} + 3 \, {\left (g x + f\right )}^{n} c e^{2} f g^{3} n^{2} x^{3} + 21 \, {\left (g x + f\right )}^{n} c d e g^{4} n^{2} x^{3} + 11 \, {\left (g x + f\right )}^{n} c e^{2} g^{4} n x^{4} + 2 \, {\left (g x + f\right )}^{n} c d^{2} f g^{3} n^{3} x - 3 \, {\left (g x + f\right )}^{n} c e^{2} f^{2} g^{2} n^{2} x^{2} + 15 \, {\left (g x + f\right )}^{n} c d e f g^{3} n^{2} x^{2} + 16 \, {\left (g x + f\right )}^{n} c d^{2} g^{4} n^{2} x^{2} + {\left (g x + f\right )}^{n} a e g^{4} n^{3} x^{2} + 2 \, {\left (g x + f\right )}^{n} c e^{2} f g^{3} n x^{3} + 42 \, {\left (g x + f\right )}^{n} c d e g^{4} n x^{3} + 6 \, {\left (g x + f\right )}^{n} c e^{2} g^{4} x^{4} - 6 \, {\left (g x + f\right )}^{n} c d e f^{2} g^{2} n^{2} x + 14 \, {\left (g x + f\right )}^{n} c d^{2} f g^{3} n^{2} x + {\left (g x + f\right )}^{n} a e f g^{3} n^{3} x + {\left (g x + f\right )}^{n} a d g^{4} n^{3} x - 3 \, {\left (g x + f\right )}^{n} c e^{2} f^{2} g^{2} n x^{2} + 12 \, {\left (g x + f\right )}^{n} c d e f g^{3} n x^{2} + 38 \, {\left (g x + f\right )}^{n} c d^{2} g^{4} n x^{2} + 8 \, {\left (g x + f\right )}^{n} a e g^{4} n^{2} x^{2} + 24 \, {\left (g x + f\right )}^{n} c d e g^{4} x^{3} - 2 \, {\left (g x + f\right )}^{n} c d^{2} f^{2} g^{2} n^{2} + {\left (g x + f\right )}^{n} a d f g^{3} n^{3} + 6 \, {\left (g x + f\right )}^{n} c e^{2} f^{3} g n x - 24 \, {\left (g x + f\right )}^{n} c d e f^{2} g^{2} n x + 24 \, {\left (g x + f\right )}^{n} c d^{2} f g^{3} n x + 7 \, {\left (g x + f\right )}^{n} a e f g^{3} n^{2} x + 9 \, {\left (g x + f\right )}^{n} a d g^{4} n^{2} x + 24 \, {\left (g x + f\right )}^{n} c d^{2} g^{4} x^{2} + 19 \, {\left (g x + f\right )}^{n} a e g^{4} n x^{2} + 6 \, {\left (g x + f\right )}^{n} c d e f^{3} g n - 14 \, {\left (g x + f\right )}^{n} c d^{2} f^{2} g^{2} n - {\left (g x + f\right )}^{n} a e f^{2} g^{2} n^{2} + 9 \, {\left (g x + f\right )}^{n} a d f g^{3} n^{2} + 12 \, {\left (g x + f\right )}^{n} a e f g^{3} n x + 26 \, {\left (g x + f\right )}^{n} a d g^{4} n x + 12 \, {\left (g x + f\right )}^{n} a e g^{4} x^{2} - 6 \, {\left (g x + f\right )}^{n} c e^{2} f^{4} + 24 \, {\left (g x + f\right )}^{n} c d e f^{3} g - 24 \, {\left (g x + f\right )}^{n} c d^{2} f^{2} g^{2} - 7 \, {\left (g x + f\right )}^{n} a e f^{2} g^{2} n + 26 \, {\left (g x + f\right )}^{n} a d f g^{3} n + 24 \, {\left (g x + f\right )}^{n} a d g^{4} x - 12 \, {\left (g x + f\right )}^{n} a e f^{2} g^{2} + 24 \, {\left (g x + f\right )}^{n} a d f g^{3}}{g^{4} n^{4} + 10 \, g^{4} n^{3} + 35 \, g^{4} n^{2} + 50 \, g^{4} n + 24 \, g^{4}} \]

input
integrate((e*x+d)*(g*x+f)^n*(c*e*x^2+2*c*d*x+a),x, algorithm="giac")
 
output
((g*x + f)^n*c*e^2*g^4*n^3*x^4 + (g*x + f)^n*c*e^2*f*g^3*n^3*x^3 + 3*(g*x 
+ f)^n*c*d*e*g^4*n^3*x^3 + 6*(g*x + f)^n*c*e^2*g^4*n^2*x^4 + 3*(g*x + f)^n 
*c*d*e*f*g^3*n^3*x^2 + 2*(g*x + f)^n*c*d^2*g^4*n^3*x^2 + 3*(g*x + f)^n*c*e 
^2*f*g^3*n^2*x^3 + 21*(g*x + f)^n*c*d*e*g^4*n^2*x^3 + 11*(g*x + f)^n*c*e^2 
*g^4*n*x^4 + 2*(g*x + f)^n*c*d^2*f*g^3*n^3*x - 3*(g*x + f)^n*c*e^2*f^2*g^2 
*n^2*x^2 + 15*(g*x + f)^n*c*d*e*f*g^3*n^2*x^2 + 16*(g*x + f)^n*c*d^2*g^4*n 
^2*x^2 + (g*x + f)^n*a*e*g^4*n^3*x^2 + 2*(g*x + f)^n*c*e^2*f*g^3*n*x^3 + 4 
2*(g*x + f)^n*c*d*e*g^4*n*x^3 + 6*(g*x + f)^n*c*e^2*g^4*x^4 - 6*(g*x + f)^ 
n*c*d*e*f^2*g^2*n^2*x + 14*(g*x + f)^n*c*d^2*f*g^3*n^2*x + (g*x + f)^n*a*e 
*f*g^3*n^3*x + (g*x + f)^n*a*d*g^4*n^3*x - 3*(g*x + f)^n*c*e^2*f^2*g^2*n*x 
^2 + 12*(g*x + f)^n*c*d*e*f*g^3*n*x^2 + 38*(g*x + f)^n*c*d^2*g^4*n*x^2 + 8 
*(g*x + f)^n*a*e*g^4*n^2*x^2 + 24*(g*x + f)^n*c*d*e*g^4*x^3 - 2*(g*x + f)^ 
n*c*d^2*f^2*g^2*n^2 + (g*x + f)^n*a*d*f*g^3*n^3 + 6*(g*x + f)^n*c*e^2*f^3* 
g*n*x - 24*(g*x + f)^n*c*d*e*f^2*g^2*n*x + 24*(g*x + f)^n*c*d^2*f*g^3*n*x 
+ 7*(g*x + f)^n*a*e*f*g^3*n^2*x + 9*(g*x + f)^n*a*d*g^4*n^2*x + 24*(g*x + 
f)^n*c*d^2*g^4*x^2 + 19*(g*x + f)^n*a*e*g^4*n*x^2 + 6*(g*x + f)^n*c*d*e*f^ 
3*g*n - 14*(g*x + f)^n*c*d^2*f^2*g^2*n - (g*x + f)^n*a*e*f^2*g^2*n^2 + 9*( 
g*x + f)^n*a*d*f*g^3*n^2 + 12*(g*x + f)^n*a*e*f*g^3*n*x + 26*(g*x + f)^n*a 
*d*g^4*n*x + 12*(g*x + f)^n*a*e*g^4*x^2 - 6*(g*x + f)^n*c*e^2*f^4 + 24*(g* 
x + f)^n*c*d*e*f^3*g - 24*(g*x + f)^n*c*d^2*f^2*g^2 - 7*(g*x + f)^n*a*e...
 
3.9.7.9 Mupad [B] (verification not implemented)

Time = 11.96 (sec) , antiderivative size = 572, normalized size of antiderivative = 3.92 \[ \int (d+e x) (f+g x)^n \left (a+2 c d x+c e x^2\right ) \, dx=\frac {x\,{\left (f+g\,x\right )}^n\,\left (2\,c\,d^2\,f\,g^3\,n^3+14\,c\,d^2\,f\,g^3\,n^2+24\,c\,d^2\,f\,g^3\,n-6\,c\,d\,e\,f^2\,g^2\,n^2-24\,c\,d\,e\,f^2\,g^2\,n+a\,d\,g^4\,n^3+9\,a\,d\,g^4\,n^2+26\,a\,d\,g^4\,n+24\,a\,d\,g^4+6\,c\,e^2\,f^3\,g\,n+a\,e\,f\,g^3\,n^3+7\,a\,e\,f\,g^3\,n^2+12\,a\,e\,f\,g^3\,n\right )}{g^4\,\left (n^4+10\,n^3+35\,n^2+50\,n+24\right )}-\frac {{\left (f+g\,x\right )}^n\,\left (2\,c\,d^2\,f^2\,g^2\,n^2+14\,c\,d^2\,f^2\,g^2\,n+24\,c\,d^2\,f^2\,g^2-6\,c\,d\,e\,f^3\,g\,n-24\,c\,d\,e\,f^3\,g-a\,d\,f\,g^3\,n^3-9\,a\,d\,f\,g^3\,n^2-26\,a\,d\,f\,g^3\,n-24\,a\,d\,f\,g^3+6\,c\,e^2\,f^4+a\,e\,f^2\,g^2\,n^2+7\,a\,e\,f^2\,g^2\,n+12\,a\,e\,f^2\,g^2\right )}{g^4\,\left (n^4+10\,n^3+35\,n^2+50\,n+24\right )}+\frac {c\,e^2\,x^4\,{\left (f+g\,x\right )}^n\,\left (n^3+6\,n^2+11\,n+6\right )}{n^4+10\,n^3+35\,n^2+50\,n+24}+\frac {x^2\,{\left (f+g\,x\right )}^n\,\left (n+1\right )\,\left (2\,c\,d^2\,g^2\,n^2+14\,c\,d^2\,g^2\,n+24\,c\,d^2\,g^2+3\,c\,d\,e\,f\,g\,n^2+12\,c\,d\,e\,f\,g\,n-3\,c\,e^2\,f^2\,n+a\,e\,g^2\,n^2+7\,a\,e\,g^2\,n+12\,a\,e\,g^2\right )}{g^2\,\left (n^4+10\,n^3+35\,n^2+50\,n+24\right )}+\frac {c\,e\,x^3\,{\left (f+g\,x\right )}^n\,\left (12\,d\,g+3\,d\,g\,n+e\,f\,n\right )\,\left (n^2+3\,n+2\right )}{g\,\left (n^4+10\,n^3+35\,n^2+50\,n+24\right )} \]

input
int((f + g*x)^n*(d + e*x)*(a + 2*c*d*x + c*e*x^2),x)
 
output
(x*(f + g*x)^n*(24*a*d*g^4 + 26*a*d*g^4*n + 9*a*d*g^4*n^2 + a*d*g^4*n^3 + 
7*a*e*f*g^3*n^2 + a*e*f*g^3*n^3 + 24*c*d^2*f*g^3*n + 6*c*e^2*f^3*g*n + 14* 
c*d^2*f*g^3*n^2 + 2*c*d^2*f*g^3*n^3 + 12*a*e*f*g^3*n - 24*c*d*e*f^2*g^2*n 
- 6*c*d*e*f^2*g^2*n^2))/(g^4*(50*n + 35*n^2 + 10*n^3 + n^4 + 24)) - ((f + 
g*x)^n*(6*c*e^2*f^4 + 24*c*d^2*f^2*g^2 - 24*a*d*f*g^3 + 12*a*e*f^2*g^2 - 9 
*a*d*f*g^3*n^2 - a*d*f*g^3*n^3 + 7*a*e*f^2*g^2*n + a*e*f^2*g^2*n^2 + 14*c* 
d^2*f^2*g^2*n - 24*c*d*e*f^3*g - 26*a*d*f*g^3*n + 2*c*d^2*f^2*g^2*n^2 - 6* 
c*d*e*f^3*g*n))/(g^4*(50*n + 35*n^2 + 10*n^3 + n^4 + 24)) + (c*e^2*x^4*(f 
+ g*x)^n*(11*n + 6*n^2 + n^3 + 6))/(50*n + 35*n^2 + 10*n^3 + n^4 + 24) + ( 
x^2*(f + g*x)^n*(n + 1)*(24*c*d^2*g^2 + 12*a*e*g^2 + 2*c*d^2*g^2*n^2 + 7*a 
*e*g^2*n + a*e*g^2*n^2 + 14*c*d^2*g^2*n - 3*c*e^2*f^2*n + 3*c*d*e*f*g*n^2 
+ 12*c*d*e*f*g*n))/(g^2*(50*n + 35*n^2 + 10*n^3 + n^4 + 24)) + (c*e*x^3*(f 
 + g*x)^n*(12*d*g + 3*d*g*n + e*f*n)*(3*n + n^2 + 2))/(g*(50*n + 35*n^2 + 
10*n^3 + n^4 + 24))